package utilcode.util;

import java.util.HashMap;
import java.util.Map;

public class CacheControl {
	private Map<String, Object> _cahce = new HashMap<String, Object>();

	private static CacheControl _instance = null;

	private CacheControl() {
	}

	public static CacheControl GetInstance() {
		if (CacheControl._instance == null)
			CacheControl._instance = new CacheControl();
		return CacheControl._instance;
	}

	public void addOrUpdate(String key, Object value) {
		synchronized (this) {
			_cahce.put(key, value);
		}
	}

	public Object get(String key) {
		synchronized (this) {
			if (_cahce.containsKey(key)) {
				return _cahce.get(key);
			} else
				return null;
		}
	}
}
